from rest_framework import serializers
from booktest.models import BookInfo
from rest_framework.viewsets import ModelViewSet

# 1.序列化器
class BookInfoSerializer(serializers.ModelSerializer):
    class Meta:
        model = BookInfo
        fields = "__all__"

# 2.类视图
class BookInfoViewSet(ModelViewSet):
    serializer_class = BookInfoSerializer
    queryset = BookInfo.objects.all()